﻿@model JT.WEB.Views.PaginatedList<JT.WEB.Models.Were.TbWuPinInfo>

    @{
    ViewData["Title"] = "物品管理";
    }

    <form asp-action="WuPinIndex" method="get">
        <div class="form-actions no-color">

            <input type="text" name="SearchString" value="@ViewData[" currentFilter"]"
                class="form-control col-sm-4 search" style="float:left;" />
            <input type="submit" value="搜索" class="btn btn-outline-success" /> |
            <a asp-action="WuPinIndex">返回物品管理</a>

        </div>
    </form>
    <table class="table table-hover table-bordered table-sm text-center">
        <thead>
            <tr class="table-success">
                <th>
                    <a asp-action="WuPinIndex" asp-route-sortOrder="@ViewData[" NameClassSortParm"]"
                       asp-route-currentFilter="@ViewData[" CurrentFilter"]">物品类别</a>
                </th>
                <th>
                    <a asp-action="WuPinIndex" asp-route-sortOrder="@ViewData[" NameSortParm"]"
                       asp-route-currentFilter="@ViewData[" CurrentFilter"]">物品名</a>
                </th>
                <th>
                    <a asp-action="WuPinIndex" asp-route-sortOrder="@ViewData[" NumberSortParm"]"
                       asp-route-currentFilter="@ViewData[" CurrentFilter"]">库存</a>
                </th>
                <th>单位</th>
                <th>
                    规格
                </th>
                <th>
                    <a asp-action="WuPinIndex" asp-route-sortOrder="@ViewData[" PriceSortParm"]"
                       asp-route-currentFilter="@ViewData[" CurrentFilter"]">价格</a>
                </th>
                <th>
                    操作人
                </th>
                <th>修改</th>
                <th>删除</th>
            </tr>

        </thead>
        <tbody>
            @foreach (var item in Model)
            {
            <tr>
                <td>@item.NameClassNavigation.NameClass</td>
                <td>@item.ItemName</td>
                <td>@item.Inventory</td>
                <td>@item.UnitName</td>
                <td>@item.CStandard</td>
                <td>@item.UnitPrice</td>
                <td>@item.Recorder</td>
                <td>
                    <button asp-action="WuPinEdit" asp-route-id="@item.NameId" data-toggle="tooltip" data-placement="top" title="修改" class="btn btn-secondary btn-sm"><span class="fa fa-pencil"></span></button>
                </td>
                <td>
                    <form asp-action="WuPinDelete" method="post">
                        <button type="submit" asp-route-id="@item.NameId" asp-action="WuPinDelete" class="btn btn-sm btn-danger" data-toggle="tooltip" data-placement="top" title="删除"><span class="fa fa-trash"></span></button>
                    </form>
                </td>
            </tr>
            }

        </tbody>
    </table>
    @{
    var prevDisabled = !Model.HasPreviousPage ? "disabled" : "";
    var nextDisabled = !Model.HasNextPage ? "disabled" : "";
    }

    <a asp-action="WuPinIndex" asp-route-sortOrder="@ViewData[" CurrentSort"]"
        asp-route-pageNumber="@(Model.PageIndex - 1)" asp-route-currentFilter="@ViewData[" CurrentFilter"]"
        class="btn btn-outline-success @prevDisabled">
        上一页
    </a>
    <a asp-action="WuPinIndex" asp-route-sortOrder="@ViewData[" CurrentSort"]"
        asp-route-pageNumber="@(Model.PageIndex + 1)" asp-route-currentFilter="@ViewData[" CurrentFilter"]"
        class="btn btn-outline-success @nextDisabled">
        下一页
    </a>

    <a asp-action="WuPinCreate" class="btn btn-outline-success">增加物品</a>&nbsp;&nbsp;|&nbsp;
    <a asp-action="Index">返回出入库管理</a>
    <script>
    $(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip();
});
    </script>